package com.ctgu.蓝桥杯真题.B组2016;

/**
 * @author: Backdiy
 * @data: 2021/4/14 16:27
 * @desc:
 */
public class E抽签 {
    static public class A {
        public static void f(int[] a, int k, int n, String s) {
            if (k == a.length) {
                if (n == 0) System.out.println(s);
                return;
            }

            String s2 = s;
            for (int i = 0; i <= a[k]; i++) {
                f(a, k + 1, n - i, s2);   //填空位置
                s2 += (char) (k + 'A');
            }
        }

        public static void main(String[] args) {
            int[] a = {4, 2, 2, 1, 1, 3};

            f(a, 0, 5, "");
        }
    }
}
